import QtQuick 2.0

Rectangle {
    id: root
    property alias text: edit.text
    width: 200
    height: 25
    color: "black"
    opacity: 0.5
    radius: 4

    signal returnPressed()

    onFocusChanged: { if (activeFocus) edit.focus = true; }

    TextInput {
        id: edit
        anchors.verticalCenter: parent.verticalCenter
        width: parent.width
        x: 5
        color: "white"
        //cursorVisible: true
        text: "124234"
        font.family: "Orbitron"; font.pointSize: 10
        selectByMouse: true
        selectionColor: "gray"
        selectedTextColor: "black"
        Keys.onReturnPressed: root.returnPressed()
    }

    IconButton {
        width: 20; height: 20
        anchors.right: parent.right
        anchors.verticalCenter: parent.verticalCenter
        icon: "img/trash.png"
        onClicked: edit.text = ""
    }
}
